package com.moioo.exam;

import java.text.SimpleDateFormat;
import java.util.Date;

import org.apache.struts.action.ActionForm;

import com.moioo.util.html.OptionUtil;

/**
 * TUser entity.
 * 
 * @author MyEclipse Persistence Tools
 */

public class TUserLog extends ActionForm implements java.io.Serializable {

	private static final long serialVersionUID = 5432985715637003074L;
	private Integer id;
	private Integer userid;
	private String username;
	private Integer organid;
	private String organname;
	private String organnamestr;
	private Date starttime;
	private Date endtime;
	private String clientip;
	
	private Integer count;
	private Long time;

	/** default constructor */
	public TUserLog() {
	}

	/** full constructor */
	public TUserLog(Integer userid, String username, Integer organid, String organname,
			String clientip) {
		this.userid = userid;
		this.username = username;
		this.organid = organid;
		this.organname = organname;
		this.clientip = clientip;
		this.starttime=new Date();
		this.endtime=new Date();
	}

	// Property accessors

	public Integer getId() {
		return this.id;
	}

	public void setId(Integer id) {
		this.id = id;
	}

	public String getUsername() {
		return this.username;
	}

	public void setUsername(String username) {
		this.username = username;
	}

	public Integer getUserid() {
		return this.userid;
	}

	public void setUserid(Integer userid) {
		this.userid = userid;
	}
	public Integer getOrganid() {
		return this.organid;
	}

	public void setOrganid(Integer organid) {
		this.organid = organid;
	}

	public String getOrganname() {
		return this.organname;
	}
	public void setOrganname(String organname) {
		this.organname = organname;
	}
	public String getOrgannamestr()
	{
		if (this.organid!=null)
		{
			TOrgan og=new TOrganDAO().findById(this.organid);
			if (og!=null)
			{
				if (og.getPid()>0)
				{
					this.organnamestr=og.getPOrganName()+"--"+this.organname;
				}else this.organnamestr=this.organname;
				return this.organnamestr;
			}
		}
		return "";
	}
	public String getClientip() {
		return this.clientip;
	}

	public void setClientip(String clientip) {
		this.clientip = clientip;
	}

	public Date getStarttime() {
		return this.starttime;
	}

	public void setStarttime(Date starttime) {
		this.starttime = starttime;
	}
	public Date getEndtime() {
		return this.endtime;
	}

	public void setEndtime(Date endtime) {
		this.endtime = endtime;
	}
	public void setCount(Integer count)
	{
		this.count=count;
	}
	public Integer getCount()
	{
		return this.count;
	}
	public void setTime(Long time)
	{
		this.time=time;
	}
	public Long getTime()
	{
		return this.time;
	}
	public String getTimestr()
	{
		return this.time/3600+":"+this.time%3600/60+":"+this.time%60;
	}
	public static TUserLogDAO getDAO(){
		return new TUserLogDAO();
	}
	public static TUserLog get(int id){
		return getDAO().findById(id);
	}
}